package cn.bgs.controller;


import cn.bgs.common.R;
import cn.bgs.pojo.Cell;
import cn.bgs.pojo.Floor;
import cn.bgs.service.IFloorService;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * <p>
 * 楼层表 前端控制器
 * </p>
 *
 * @author cf
 * @since 2022-06-07
 */
@RestController
@RequestMapping("/floor")
public class FloorController {

    @Autowired
    private IFloorService iFloorService;

    @GetMapping("/appFindFloor/{cellId}")
    @ApiOperation(value = "app我的房屋(添加房屋的楼层查询)")
    public R appFindFloor(@PathVariable Integer cellId){

        List<Floor> floor = iFloorService.appFindFloor(cellId);
        if (floor != null){
            return R.ok().data("floor",floor);
        }else {
            return R.error();
        }
    }
}
